import objectUtils from "@/utils/object/index.js";

export default objectUtils.freeze(function() {
	const obj = {};
	objectUtils.bindMethod(obj, "isString", function(str) {
		return Object.prototype.toString.call(str) === "[object String]";
	});
	objectUtils.bindMethod(obj, "isString", function(str, defaultStr) {
		return Object.prototype.toString.call(str) === "[object String]" ? str : defaultStr;
	});
	objectUtils.bindMethod(obj, "replaceGlobal", function(str, searchStr) {
		let re = new RegExp(searchStr, "gi");
		return str.replace(re, "");
	});
	objectUtils.bindMethod(obj, "replaceGlobal", function(str, searchStr, replaceStr) {
		let re = new RegExp(searchStr, "gi");
		return str.replace(re, replaceStr);
	});
	return obj;
}());